﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using LeoShi.Soft.OpenSinaAPI;
using System.IO;
using System.Xml;
using LTP.Common;
namespace TCS.Web.MembersHome
{
    public partial class bathattention : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var ids = Request.Params["ids"];
            string[] idlist = ids.Split(',');
            var httpRequest = HttpRequestFactory.CreateHttpRequest(Method.POST);
            httpRequest.Token = Session["oauth_token"].ToString();
            httpRequest.TokenSecret = Session["oauth_token_secret"].ToString();
            httpRequest.UserRemoteIP = Request.UserHostAddress;
            string url = "http://api.t.sina.com.cn/friendships/create.xml";
            int tempOK = 0;
            int tempFail = 0;
            for (int i = 0; i < idlist.Length; i++)
            {
                try
                {

                    httpRequest.Request(url, "user_id=" + idlist[i]);
                    tempOK++;
                }
                catch (Exception ex)
                {
                    tempFail++;
                }
            }
            Response.Write("成功：" + tempOK.ToString() + "  失败：" + tempFail.ToString());
        }
    }
}
